package com.room.search.domain;

import com.fasterxml.jackson.annotation.JsonIgnore;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.*;

/**
 * 小区表
 */
@Entity
@Table(name = "room_community")
@NamedEntityGraph(name = "community_file")
@org.springframework.data.elasticsearch.annotations.Document(indexName = "room_community")
public class RoomCommunity implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private Long id;

    /**
     * 小区名称类型
     */
    @Size(max = 8)
    @Column(name = "name", length = 8)
    private String name;

    /**
     * 均价
     */
    @Size(max = 32)
    @Column(name = "average", length = 32)
    private String average;

    /**
     * 建筑类型
     */
    @Size(max = 32)
    @Column(name = "building_type", length = 32)
    private String buildingType;

    /**
     * 物业费用
     */
    @Size(max = 8)
    @Column(name = "property_costs", length = 8)
    private String propertyCosts;

    /**
     * 物业公司
     */
    @Size(max = 32)
    @Column(name = "property_company", length = 32)
    private String propertyCompany;

    /**
     * 开发商
     */
    @Size(max = 32)
    @Column(name = "developer", length = 32)
    private String developer;

    /**
     * 楼栋总数
     */
    @Size(max = 8)
    @Column(name = "building_no", length = 8)
    private String buildingNo;

    /**
     * 房屋总数
     */
    @Size(max = 8)
    @Column(name = "room_no", length = 8)
    private String roomNo;

    /**
     * 附近门店
     */
    @Size(max = 128)
    @Column(name = "nearby_stores", length = 128)
    private String nearbyStores;

    /**
     * 受关注数量
     */
    @Size(max = 8)
    @Column(name = "focus_no", length = 8)
    private String focusNo;


    /**
     * 经度
     */
    @Column(name = "longitude")
    private String longitude;
    /**
     * 纬度
     */
    @Column(name = "latitude")
    private String latitude;

    /**
     * 具体位置
     */
    @Column(name = "address")
    private String address;

    /**
     * 省份
     */
    @Column(name = "province")
    private String province;
    /**
     * 市区
     */
    @Column(name = "city")
    private String city;
    /**
     * 区县
     */
    @Column(name = "district")
    private String district;

    /**
     * 创建时间
     */
    @Column(name = "created_date")
    private Date createdDate;



    @OneToMany(mappedBy = "community")
    @JsonIgnore
    private List<RoomFile> files;

    @OneToMany(mappedBy = "community")
    @JsonIgnore
    private List<RoomGoods> goods;



    // jhipster-needle-entity-add-field - JHipster will add fields here

    public Long getId() {
        return this.id;
    }

    public RoomCommunity id(Long id) {
        this.setId(id);
        return this;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return this.name;
    }

    public RoomCommunity name(String name) {
        this.setName(name);
        return this;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAverage() {
        return this.average;
    }

    public RoomCommunity average(String average) {
        this.setAverage(average);
        return this;
    }

    public void setAverage(String average) {
        this.average = average;
    }

    public String getBuildingType() {
        return this.buildingType;
    }

    public RoomCommunity buildingType(String buildingType) {
        this.setBuildingType(buildingType);
        return this;
    }

    public void setBuildingType(String buildingType) {
        this.buildingType = buildingType;
    }

    public String getPropertyCosts() {
        return this.propertyCosts;
    }

    public RoomCommunity propertyCosts(String propertyCosts) {
        this.setPropertyCosts(propertyCosts);
        return this;
    }

    public void setPropertyCosts(String propertyCosts) {
        this.propertyCosts = propertyCosts;
    }

    public String getPropertyCompany() {
        return this.propertyCompany;
    }

    public RoomCommunity propertyCompany(String propertyCompany) {
        this.setPropertyCompany(propertyCompany);
        return this;
    }

    public void setPropertyCompany(String propertyCompany) {
        this.propertyCompany = propertyCompany;
    }

    public String getDeveloper() {
        return this.developer;
    }

    public RoomCommunity developer(String developer) {
        this.setDeveloper(developer);
        return this;
    }

    public void setDeveloper(String developer) {
        this.developer = developer;
    }

    public String getBuildingNo() {
        return this.buildingNo;
    }

    public RoomCommunity buildingNo(String buildingNo) {
        this.setBuildingNo(buildingNo);
        return this;
    }

    public void setBuildingNo(String buildingNo) {
        this.buildingNo = buildingNo;
    }

    public String getRoomNo() {
        return this.roomNo;
    }

    public RoomCommunity roomNo(String roomNo) {
        this.setRoomNo(roomNo);
        return this;
    }

    public void setRoomNo(String roomNo) {
        this.roomNo = roomNo;
    }

    public String getNearbyStores() {
        return this.nearbyStores;
    }

    public RoomCommunity nearbyStores(String nearbyStores) {
        this.setNearbyStores(nearbyStores);
        return this;
    }

    public void setNearbyStores(String nearbyStores) {
        this.nearbyStores = nearbyStores;
    }

    public String getFocusNo() {
        return this.focusNo;
    }

    public RoomCommunity focusNo(String focusNo) {
        this.setFocusNo(focusNo);
        return this;
    }

    public void setFocusNo(String focusNo) {
        this.focusNo = focusNo;
    }

    public String getLongitude() {
        return longitude;
    }

    public RoomCommunity setLongitude(String longitude) {
        this.longitude = longitude;
        return this;
    }

    public String getLatitude() {
        return latitude;
    }

    public RoomCommunity setLatitude(String latitude) {
        this.latitude = latitude;
        return this;
    }

    public String getAddress() {
        return address;
    }

    public RoomCommunity setAddress(String address) {
        this.address = address;
        return this;
    }

    public String getProvince() {
        return province;
    }

    public RoomCommunity setProvince(String province) {
        this.province = province;
        return this;
    }

    public String getCity() {
        return city;
    }

    public RoomCommunity setCity(String city) {
        this.city = city;
        return this;
    }

    public String getDistrict() {
        return district;
    }

    public RoomCommunity setDistrict(String district) {
        this.district = district;
        return this;
    }

    public Date getCreatedDate() {
        return createdDate;
    }

    public void setCreatedDate(Date createdDate) {
        this.createdDate = createdDate;
    }

    public List<RoomFile> getFiles() {
        return files;
    }

    public RoomCommunity setFiles(List<RoomFile> files) {
        this.files = files;
        return this;
    }

    public List<RoomGoods> getGoods() {
        return goods;
    }

    public RoomCommunity setGoods(List<RoomGoods> goods) {
        this.goods = goods;
        return this;
    }

    // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof RoomCommunity)) {
            return false;
        }
        return id != null && id.equals(((RoomCommunity) o).id);
    }

    @Override
    public int hashCode() {
        // see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/
        return getClass().hashCode();
    }

    @Override
    public String toString() {
        return "RoomCommunity{" +
            "id=" + id +
            ", name='" + name + '\'' +
            ", average='" + average + '\'' +
            ", buildingType='" + buildingType + '\'' +
            ", propertyCosts='" + propertyCosts + '\'' +
            ", propertyCompany='" + propertyCompany + '\'' +
            ", developer='" + developer + '\'' +
            ", buildingNo='" + buildingNo + '\'' +
            ", roomNo='" + roomNo + '\'' +
            ", nearbyStores='" + nearbyStores + '\'' +
            ", focusNo='" + focusNo + '\'' +
            ", longitude='" + longitude + '\'' +
            ", latitude='" + latitude + '\'' +
            ", address='" + address + '\'' +
            ", province='" + province + '\'' +
            ", city='" + city + '\'' +
            ", district='" + district + '\'' +
            '}';
    }
}
